package arch.dao.impl.usync;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.jdbc.core.RowMapper;

import arch.domain.usync.SyncLog;
import arch.domain.usync.SyncLog.SyncType;
/**
 * 
 * @author <a mailto="wanglong635@126.com">Long</a>
 *
 */
public class SyncLogMapper implements RowMapper {

	public Object mapRow(ResultSet rs, int i) throws SQLException {
		SyncLog log = new SyncLog();
		log.setId(rs.getString("ID"));
		log.setExist("1".equals(rs.getString("EXIST")));
		
		String type = rs.getString("TYPE");
		if(type!=null && !"".equals(type))
			log.setType(SyncType.valueOf(type));
		
		log.setUnique(rs.getString("UNIQUE"));
		log.setContent(rs.getString("CONTENT"));
		log.setCreateTime(rs.getTimestamp("CREATE_TIME"));
		
		return log;
	}

}
